package com.zzz.web.DB;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class GetContext {
    private static ClassPathXmlApplicationContext context;
    public static ApplicationContext getContext(){
        if(context!= null){
            return context;
        }
        else {
            context = new ClassPathXmlApplicationContext("MyConfig.xml");
            return context;
        }
    }
}
